<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="sj" uri="/struts-jquery-tags"%>

<html>
<head>
<title><s:text name="pl.grabar.clinic.client.web.reception.visit.views.patient" /></title>
	<sj:head locale="pl" jqueryui="true" jquerytheme="smoothness"/>
	<link href="${pageContext.request.contextPath}/static/global/js/jquery-multiple-select/multiple-select.css" rel="stylesheet"/>
	<script type="text/javascript" src="${pageContext.request.contextPath}/static/global/js/jquery-multiple-select/jquery.multiple.select.js"></script>
	<link href="${pageContext.request.contextPath}/static/global/js/select2-3.4.5/select2.css" rel="stylesheet"/>
	<script type="text/javascript" src="${pageContext.request.contextPath}/static/global/js/select2-3.4.5/select2.js"></script>
	<script type="text/javascript" src="${pageContext.request.contextPath}/static/global/js/select2-3.4.5/select2_locale_pl.js"></script>
		<link rel="stylesheet" href="${pageContext.request.contextPath}/struts/themes/flick/jquery-ui.css">
	
	<script type="text/javascript" src="${pageContext.request.contextPath}/static/global/js/tinymce/tinymce.min.js"></script>


<script type="text/javascript">
   function item(key,value){
    this.id=key;
    this.text=value;
}
   
   function loadSelect2Script(){
       $("#idPatientSelect").select2({
       	placeholder: "Wybierz pacjenta",
           minimumInputLength: 3,
           multiple: false,
           ajax: {
   	        url: "findPatients",
   	        dataType: 'json',
   	        quietMillis: 500,
   	        data: function (term, page) {
   		        return {
   		        regex: term,
   		        page_limit: 10,//page size
   		        page: page,
   		        };
   	        },
   	        results: function (data, page) {				//liczba wszystkich znalezionych
   	        	var more = (page * data.page_limit) < Object.keys(data.listPatients).length ;//tu zamienic na liczbe stron mozliwych do przejrzenia???chyba
   	        	var items =  [];								
       			$.each(data.listPatients, function(key, value) {
   					items.push(new item(key, value));
       			});
   	        return {results: items, more: more};
   	        }
           },
           
//            initSelection : function (element, callback) {
// 			var keys = [];
// 	        $(element.val().split(",")).each(function () {
// 	            keys.push(this);
// 	        });
	        
//            	$.ajax({
//            		 url: "loadContents",
//            		 data: {
//            			 idSelectedDictionary:  $('#idSelectedDictionary').val() ,
//            			 defaultValueList: keys,
//            		 },
//            		 dataType: "json"
//            		 }).done(function(data) { 
//           		        var elements = [];
//   	        			$.each(data.listDictionaryElements, function(key, value) {
//   	        				elements.push(new item(key, value));
//   	        			});
//           			 	callback(elements); });
           	
//            }
           
       });
   }
   
	tinymce.init({
		selector: ".richTextField",
		menubar: false,
	    plugins: [
	        "advlist autolink lists link image charmap print preview anchor",
	        "searchreplace visualblocks code fullscreen",
	        "insertdatetime media table contextmenu paste"
	    ],
	    toolbar: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image"	
	});

// tinymce.init({
//     selector: ".richTextField",
//     inline: true,
//     menubar: false,
//     plugins: [
//         "advlist autolink lists link image charmap print preview anchor",
//         "searchreplace visualblocks code fullscreen",
//         "insertdatetime media table contextmenu paste"
//     ],
//     toolbar: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image"
// });

</script>

	<style type="text/css">
/* 	.ui-widget {font-size: 2em;} */
	.wwgrp{float: none;}
	.wwctrl label{font-size: xx-large; font-weight: bolder; color: black; text-shadow: aqua 0.2em 0.2em 0.2em;}
	body {
/*  	background-color: #a1bad1;  */
/* 	background-image: url(${pageContext.request.contextPath}/static/default/img/bg4.png); */
}

.patientData{
font-size: x-large;
color: blue;
background-color: highlight;
}
.wwgrp{
background: #e1ffff; /* Old browsers */
background: -moz-radial-gradient(center, ellipse cover,  #e1ffff 0%, #e1ffff 7%, #e1ffff 12%, #fdffff 12%, #e6f8fd 30%, #c8eefb 54%, #bee4f8 75%, #b1d8f5 100%); /* FF3.6+ */
background: -webkit-gradient(radial, center center, 0px, center center, 100%, color-stop(0%,#e1ffff), color-stop(7%,#e1ffff), color-stop(12%,#e1ffff), color-stop(12%,#fdffff), color-stop(30%,#e6f8fd), color-stop(54%,#c8eefb), color-stop(75%,#bee4f8), color-stop(100%,#b1d8f5)); /* Chrome,Safari4+ */
background: -webkit-radial-gradient(center, ellipse cover,  #e1ffff 0%,#e1ffff 7%,#e1ffff 12%,#fdffff 12%,#e6f8fd 30%,#c8eefb 54%,#bee4f8 75%,#b1d8f5 100%); /* Chrome10+,Safari5.1+ */
background: -o-radial-gradient(center, ellipse cover,  #e1ffff 0%,#e1ffff 7%,#e1ffff 12%,#fdffff 12%,#e6f8fd 30%,#c8eefb 54%,#bee4f8 75%,#b1d8f5 100%); /* Opera 12+ */
background: -ms-radial-gradient(center, ellipse cover,  #e1ffff 0%,#e1ffff 7%,#e1ffff 12%,#fdffff 12%,#e6f8fd 30%,#c8eefb 54%,#bee4f8 75%,#b1d8f5 100%); /* IE10+ */
background: radial-gradient(ellipse at center,  #e1ffff 0%,#e1ffff 7%,#e1ffff 12%,#fdffff 12%,#e6f8fd 30%,#c8eefb 54%,#bee4f8 75%,#b1d8f5 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#e1ffff', endColorstr='#b1d8f5',GradientType=1 ); /* IE6-9 fallback on horizontal gradient */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fcee71', endColorstr='#3aef37',GradientType=1 ); /* IE6-9 fallback on horizontal gradient */


}
	</style>
	

</head>
<body>

<div class="idH1">
	<h1>
		<s:text name="pl.grabar.clinic.client.web.reception.visit.views.edit.new-visit" />
	</h1>
</div>
	<s:form namespace="/doctor/visit" action="save">
		<s:hidden name="visitId" />
		<s:hidden name="visit.visitDate" />
		
		<div class="patientData" id="patientData">
		<s:text name="pl.grabar.clinic.client.web.labels.patient"/>: <span><s:property value="visit.patient.firstName"/> <s:property value="visit.patient.lastName"/></span>
		<br>
<%-- 		<s:text name="pl.grabar.clinic.client.web.labels.pesel"/>: <span><s:property value="visit.patient.pesel"/> </span> --%>
		</div>		
		<br></br>
		<s:label value="%{getText('pl.grabar.clinic.client.web.labels.disease')}"/>
		<s:textfield name="visit.disease.name" label="%{getText('pl.grabar.clinic.client.web.labels.disease.name')}" />
		<s:textfield name="visit.disease.symptoms" cssClass="richTextField" label="%{getText('pl.grabar.clinic.client.web.labels.disease.symptoms')}" />
		<s:textfield name="visit.disease.diagnosis" cssClass="richTextField" label="%{getText('pl.grabar.clinic.client.web.labels.disease.diagnosis')}" />
		<br></br>
		<br></br>


		<s:label value="%{getText('pl.grabar.clinic.client.web.labels.medical-examination')}"/>
		<s:textfield name="visit.healthExamination.name" label="%{getText('pl.grabar.clinic.client.web.labels.medical-examination.name')}" />
		<s:textfield name="visit.healthExamination.description" cssClass="richTextField" label="%{getText('pl.grabar.clinic.client.web.labels.medical-examination.description')}" />
		<br></br>
		<br></br>

		<s:label value="%{getText('pl.grabar.clinic.client.web.labels.medical-prescription')}"/>
		<s:textfield name="visit.medicalPrescription.medicament" cssClass="richTextField" label="%{getText('pl.grabar.clinic.client.web.labels.medical-prescription.medicament')}" />
		<s:textfield name="visit.medicalPrescription.description" cssClass="richTextField" label="%{getText('pl.grabar.clinic.client.web.labels.medical-prescription.description')}" />
		<s:textfield name="visit.medicalPrescription.dosage" cssClass="richTextField" label="%{getText('pl.grabar.clinic.client.web.labels.medical-prescription.dosage')}" />
		<br></br>

		<s:submit value="%{getText('pl.grabar.clinic.client.web.buttons.end')}" />
	</s:form>
	
</body>
</html>